/*
ID: pallab81
PROG:
LANG: C++
*/
 
//"I have not failed, I have just found 10000 ways that won't work.
 
#include <iostream>
#include <algorithm>
#include <vector>
#include <sstream>
#include <fstream>
#include <string>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <functional>
#include <bitset>
#include <iomanip>

#include <ctime>
#include <cassert>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <climits>
#include <cstring>
#include <cstdlib>

using namespace std;

#define VI vector< int >
#define CI( x ) scanf("%d",&x)
#define CL( x ) scanf("%lld",&x)
#define CD( x ) scanf("%lf",&x )
#define foR(i,st,ed) for(int i = st ; i < ed ; ++i )
#define fo(i,ed) foR( i , 0 , ed )
#define foE(i,st,ed) for(int i = st ; i <= ed ; ++i )
#define foit(i, x) for (typeof((x).begin()) i = (x).begin(); i != (x).end(); i++)
#define bip system("pause")
#define Int long long
#define pb push_back
#define SZ(X) (int)(X).size()
#define LN(X) (int)(X).length()
#define mk make_pair
#define f first
#define s second
#define SET( ARRAY , VALUE ) memset( ARRAY , VALUE , sizeof(ARRAY) ) 

class SmallBricks31 {
public:
	int countWays(int w, int h);
};
const int mod = 1000000007;
Int dp[ 1<<11 ][ 11 ][ 11 ];
int W;

// check possible 
inline bool P(int msk, int bit ){
	return ( ( msk&(1<<bit) )!=0 ) ;
}
Int go( int msk, int r, int c ){
	if( r==0 ){
		return 1;
	}
	if( c==W ){
		return go( msk, r-1, 0 );	
	}
	Int& res = dp[ msk ][ r ][ c ];
	if( res>=0 ){
		return res;
	}
	res = 0;
	// na niye
	
	// clear the bit
	Int v1 = go( msk& ( ~(1<<c) ), r, c+1 );
	res = ( res + v1 ) % mod ;
	
	//1*1*1 
	//1
	//10
	//100
	//1000
	if( P(msk,c) ){
		int nwmask = msk|(1<<c);
		Int v2 = go( nwmask, r, c+1 );
		res = (res+v2) % mod ;
	}
	
	//1*1*2
	//11
	//110
	//11000
	//110000
	
	if( c+2<=W && P(msk,c) && P(msk,c+1)  ){
		int nwmsk  = msk|(1<<c)|(1<<(c+1));
		Int v2 = go( nwmsk, r, c+2 );
		res = (res+v2) % mod ;
	}
	
	//1*1*3
	//111
	//1110
	//11100
	//111000
	if( c+3<=W && P(msk,c) && P(msk,c+2) ){
		int nwmsk  = msk|(1<<c)|(1<<(c+1))|(1<<(c+2));
		Int v2 = go( nwmsk, r, c+3 );
		res = (res+v2) % mod ;
	}
	
return res;
}
int SmallBricks31 :: countWays(int w, int h) {
	
		W = w;
		SET(dp,-1);
		Int retval = go( (1<<w)-1 , h, 0 );
	return (int)( retval%mod) ;
}
// BEGIN KAWIGIEDIT TESTING
// Generated by KawigiEdit 2.1.8 (beta) modified by pivanof
#include <iostream>
#include <string>
#include <vector>
using namespace std;
bool KawigiEdit_RunTest(int testNum, int p0, int p1, bool hasAnswer, int p2) {
	cout << "Test " << testNum << ": [" << p0 << "," << p1;
	cout << "]" << endl;
	SmallBricks31 *obj;
	int answer;
	obj = new SmallBricks31();
	clock_t startTime = clock();
	answer = obj->countWays(p0, p1);
	clock_t endTime = clock();
	delete obj;
	bool res;
	res = true;
	cout << "Time: " << double(endTime - startTime) / CLOCKS_PER_SEC << " seconds" << endl;
	if (hasAnswer) {
		cout << "Desired answer:" << endl;
		cout << "\t" << p2 << endl;
	}
	cout << "Your answer:" << endl;
	cout << "\t" << answer << endl;
	if (hasAnswer) {
		res = answer == p2;
	}
	if (!res) {
		cout << "DOESN'T MATCH!!!!" << endl;
	} else if (double(endTime - startTime) / CLOCKS_PER_SEC >= 2) {
		cout << "FAIL the timeout" << endl;
		res = false;
	} else if (hasAnswer) {
		cout << "Match :-)" << endl;
	} else {
		cout << "OK, but is it right?" << endl;
	}
	cout << "" << endl;
	return res;
}
int main() {
	bool all_right;
	all_right = true;
	
	int p0;
	int p1;
	int p2;
	
	{
	// ----- test 0 -----
	p0 = 1;
	p1 = 3;
	p2 = 4;
	all_right = KawigiEdit_RunTest(0, p0, p1, true, p2) && all_right;
	// ------------------
	}
	
	{
	// ----- test 1 -----
	p0 = 3;
	p1 = 1;
	p2 = 13;
	all_right = KawigiEdit_RunTest(1, p0, p1, true, p2) && all_right;
	// ------------------
	}
	
	{
	// ----- test 2 -----
	p0 = 3;
	p1 = 2;
	p2 = 84;
	all_right = KawigiEdit_RunTest(2, p0, p1, true, p2) && all_right;
	// ------------------
	}
	
	{
	// ----- test 3 -----
	p0 = 4;
	p1 = 9;
	p2 = 132976888;
	all_right = KawigiEdit_RunTest(3, p0, p1, true, p2) && all_right;
	// ------------------
	}
	
	{
	// ----- test 4 -----
	p0 = 5;
	p1 = 5;
	p2 = 11676046;
	all_right = KawigiEdit_RunTest(4, p0, p1, true, p2) && all_right;
	// ------------------
	}
	
	if (all_right) {
		cout << "You're a stud (at least on the example cases)!" << endl;
	} else {
		cout << "Some of the test cases had errors." << endl;
	}
	return 0;
}
// END KAWIGIEDIT TESTING


//Powered by KawigiEdit 2.1.8 (beta) modified by pivanof!
